package com.survey.Controller;

import com.survey.pojo.data.QuestionDO;
import com.survey.pojo.vo.QuestionVO;
import com.survey.service.QuestionService;
import com.survey.utils.Result;
import com.survey.utils.SayUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * 
 */
@Controller
public class SayController {
    
    @Resource
    QuestionService questionService;
    
    @RequestMapping("/say")
    @ResponseBody
    public Result say(QuestionVO questionVO) throws Exception {
        QuestionDO detailQuestion = questionService.findDetailQuestion(questionVO);
        String head = detailQuestion.getHead();
        SayUtil.say(head);
        return new Result(Result.CODE_SUCCESS);
    }
}
